from django.http import HttpResponse
import os

def getlinks():
    return [
        ("/comics/", "Archive"),
        ("/contribute/", "Contribute"),
    ]

def present_image(comic):
    """
    given a Comic, returns an HttpResponse with data from the Comic's
    image file and an appropriate mimetype
    """
    f = file(comic.get_comic_filename())
    if "jpg" in comic.comic:
        mime = "image/jpg"
    else:
        mime = "image/png"
    response = HttpResponse(f.read(), mimetype=mime)
    response['Content-Length'] = os.path.getsize(comic.get_comic_filename())
    return response
